<template>
	<view>
		<u-empty 
			v-show="!lists.length"
			text="下载列表为空"/>
		<u-list
			v-if="lists.length > 0"
			:showScrollbar="true" 
			:scrollWithAnimation="true" 
			:enableBackToTop="true" 
			:pagingEnabled="true">
			<u-list-item v-for="(item, index) in lists" :key="`item_${index}`">
				<download-game-item :data="item" :index="index" @del="downloadAbort(index)"></download-game-item>
			</u-list-item>
		</u-list>
	</view>
</template>

<script>
	import downloadGameItem from "@/components/download-game-item.vue";
	export default {
		components: {
			downloadGameItem,
		},
		data() {
			return {
				
			};
		},
		computed: {
			lists() {
				return this.$store.state.download.lists;
			}
		},
		methods: {
			setDownloads() {
				
			},
			downloadAbort(index) {
				this.$store.commit("download/LISTS_DEL", index);
			}
		},
		onLoad(options) {
			console.log(this.lists.length);
			console.log(this.lists);
			// this.$store.state.download.lists.map((v, k) => {
			// 	if (!v.download) this.$store.commit("download/LISTS_DEL", k);
			// });
		},
		onShow(options) {

		}
	}
</script>

<style lang="scss" scoped>
	// ::v-deep .uni-progress-bar {
	// 	width: 40vw;
	// }


</style>